<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Daishu extends Model
{
    protected  $fillable = ['uname','mobile'];

    /**
     * @param $ids
     * @return array
     * 导出数据
     */
    public function getExportData(){

        $cellDatas = Daishu::orderBy('id', 'desc')
                ->get();
        //表头
        $cellData[0] = ['用户ID','姓名','电话号码'];

        if(count($cellDatas)) {
            foreach ($cellDatas as $item) {
                $cellData[] = [$item['id'], $item->uname, $item->mobile];
            }
        }
        return $cellData;
    }
}
